//CSP2021 Junior Competition2
//Problem 2 sort
//With code as pen, draw beautiful pictures.
//By cyrxdzj
#include<cstdio>
using namespace std;
struct node
{
	int a,i;
}b[8005];
int n,q;
int a[8005],ans[8005];
bool flag=false;
int get_ans(int x)
{
	if(!flag)
	{
		for(int i=1;i<=n;i++)
		{
			b[i].a=a[i];
			b[i].i=i;
			ans[i]=i;
		}
		for(int i=1;i<=n;i++)
		{
			for(int j=i;j>=2;j--)
			{
				if(b[j].a<b[j-1].a)
				{
					int t;
					t=b[j].a;
					b[j].a=b[j-1].a;
					b[j-1].a=t;
					t=b[j].i;
					b[j].i=b[j-1].i;
					b[j-1].i=t;
					ans[b[j].i]=j;
					ans[b[j-1].i]=j-1;
				}
			}
		}
		flag=true;
	}
	return ans[x];
}
int main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d%d",&n,&q);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
	}
	for(int i=1;i<=q;i++)
	{
		int o;
		scanf("%d",&o);
		if(o==1)
		{
			int x,v;
			scanf("%d%d",&x,&v);
			a[x]=v;
			flag=false;
		}
		else
		{
			int x;
			scanf("%d",&x);
			printf("%d\n",get_ans(x));
		}
	}
	return 0;
}

